package com.zline.foodraise.adapter;

import android.content.Context;
import android.view.ViewGroup;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.zline.foodraise.R;
import com.zline.foodraise.util.ImageUtil;
import com.zline.foodraise.view.DynamicItemProPicturesItem;
import com.zline.foodraise.view.DynamicItemProPicturesItem_;

import org.androidannotations.annotations.Bean;
import org.androidannotations.annotations.EBean;
import org.androidannotations.annotations.RootContext;

/**
 * Created by heshantao on 15/7/6.
 * 动态信息图片Item
 */
@EBean
public class DynamicItemProPicturesItemAdapter extends RecyclerViewBaseAdapter<String,DynamicItemProPicturesItem>{
    private static final String LOG_TAG=DynamicItemProPicturesItemAdapter.class.getSimpleName();
    @RootContext
    Context cxt;
    @Bean
    ImageUtil imageUtil;
    DisplayImageOptions options;
    @Override
    protected DynamicItemProPicturesItem onCreateItemView(ViewGroup parent, int viewType) {
        return DynamicItemProPicturesItem_.build(cxt);
    }

    @Override
    public void onBindViewHolder(ViewWrapper<DynamicItemProPicturesItem> holder, int position) {
        DynamicItemProPicturesItem view=holder.getView();
        String picUrl=arrys.get(position);
        if(options==null){
            options = imageUtil.
                    getDisplayImageOptions(R.mipmap.default_product_icon,
                            R.mipmap.default_product_icon, R.mipmap.default_product_icon);
        }
        view.setRecyclerItemClick(itemClicked);
        view.bind(picUrl,position,parentPosition,options);

    }
}
